
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

public class TextView extends JFrame {
   private JTextArea t;
   private String s;

   public TextView( String title ) {
      super( title );
      Box b = Box.createHorizontalBox();

      JFileChooser chooser = new JFileChooser();
      int returnValue = chooser.showOpenDialog( null );
      File file = new File( chooser.getCurrentDirectory(), chooser.getSelectedFile().getName() );
      try{
         DataInputStream in = new DataInputStream( new FileInputStream( file ) );
         s = "";
         while( true )
            s += (char)in.readByte();
      } catch ( IOException i ) {}

      t = new JTextArea( s, 10, 15 );
      t.setFont( new Font( "MONOSPACED", Font.PLAIN, 12 ) );
      b.add( new JScrollPane( t ) );

      Container c = getContentPane();
      c.add( b );
      setSize( 800, 400 );
      show();

   }

}

